package cn.yunhe.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	private static SimpleDateFormat SDF_DATE=new SimpleDateFormat("yyyy-MM-dd");
	private static SimpleDateFormat SDF_DATE_TIME=new SimpleDateFormat("yyyy-MM-dd HH:hh:ss");
	public static String DateToString(Date date){
		return SDF_DATE.format(date);
	}
	public static Date StringToDate(String dateStr) throws ParseException{
		return SDF_DATE.parse(dateStr);
	}
	public static String DateTimeTOString(Date date){
		return SDF_DATE_TIME.format(date);
	}
	public static Date StringToDateTime(String dateStr) throws ParseException{
		return SDF_DATE_TIME.parse(dateStr);
	}
}
